<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .before {
      color: red;
    }

    .after {
      color: blue;
    }

    .new::before,
    .item::before {
      content: "321";
      color: orange;
      font-size: 20px;
    }

    .item::after {
      /* content: "cba"; */
      content: url('../images/hot_icon.svg');
      color: green;
      font-size: 20px;
      /* 相对定位 */
      position: relative;
      left: 5px;
      top: 2px;
    }

    .new::after {
      content: url('../images/new_icon.svg');
      color: green;
      font-size: 20px;

      position: relative;
      left: 5px;
      top: 2px;
    }

    .box6::after {
      content: '';
      display: inline-block;
      width: 8px;
      height: 8px;
      background-color: #f00;
    }
  </style>
</head>

<body>
  <div class="box">
    <span class="before">123</span>
    我是div元素
    <span class="after">abc</span>
  </div>

  <div class="box2">
    <span class="before">123</span>
    我是div2元素
    <span class="after">abc</span>
  </div>

  <!-- 伪元素方案 -->
  <div class="box3 item">我是div3元素</div>
  <div class="box4 item">我是div4元素</div>

  <div class="box5 new">我是div5元素</div>

  <div class="box6">我是div6元素</div>

</body>

</html>